home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1995 February / 1995-02b.d64 / mailing list (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  110 lines

  1. 0 rem copyright 1995 - compute publications intl ltd - all rights reserved
  2. 5 poke53280,6:gosub 1109
  3. 10 restore:ln=0:print"[147]"
  4. 11 printspc(09)"[158]                     "
  5. 12 printspc(09)"[158]                     "
  6. 13 printspc(09)"[158]                     "
  7. 14 print"   mailing list    [158]"
  8. 15 print
  9. 20 printtab(9) " f1 [146] list all last names"
  10. 22 printtab(9) " f3 [146] search for name"
  11. 23 printtab(9) " f4 [146] to add names"
  12. 24 printtab(9) " f5 [146] all names & addresses"
  13. 25 printtab(9) " f7 [146] to quit"
  14. 50 get q$:ifq$=""then 50
  15. 51 ifq$="[138]"thenprint"[147]":list500-699
  16. 52 ifq$="[133]"thenifxn=1thenln=1:x=0:goto1250
  17. 53 ifq$="[133]"thenln=1:x=0:print"[147]  *** sorting"nn"names ***"
  18. 55 ifq$="[133]"then1160
  19. 60 ifq$="[134]"then300
  20. 62 ifq$="[135]"thenprint"[147]":goto400
  21. 66 ifq$="[136]"then700
  22. 70 goto 50
  23. 299 rem search for name
  24. 300 print"[153][147]last name";:inputll$:print""
  25. 301 m=0
  26. 320 readl$,f$,a$,c$,s$,z$,p$
  27. 325 ifl$=ll$thenprintf$" "l$ :goto330
  28. 327 ifl$<>"*"then320
  29. 328 if m=1then360
  30. 329 ifl$ ="*"then print"sorry,  "ll$" [146] not listed.":fordd=1to2000:next:goto10
  31. 330 printa$
  32. 340 printc$ ", "s$" ";
  33. 350 printz$
  34. 352 printp$:print:m=1
  35. 355 ifl$<>"*"then320
  36. 360 print"[153] hit space bar to cont. hit p to print  "
  37. 370 geta$:ifa$=""then370
  38. 375 if a$="p"thengosub1500
  39. 380 goto10
  40. 400 print"[147]":i=0
  41. 401 i=i+1
  42. 402 readl$,f$,a$,c$,s$,z$,p$
  43. 403 ifl$ ="*"theni=4:goto410
  44. 404 printf$" "l$
  45. 405 printa$
  46. 407 printc$" "s$" "z$
  47. 408 printp$:print
  48. 410 ifi=4then print"[153] hit space bar to cont. ":goto420
  49. 418 if l$<>"*" then401
  50. 420 getss$:if ss$=""then420
  51. 424 ifl$="*"then 10
  52. 426 goto400
  53. 500 rem add names to data statements
  54. 501 data last name,first name, address, city, state, zipcode, phone number
  55. 502 data smith, jim, 125 elm st. apt.#3,hometown,nc,27272,(555) 234-5678
  56. 503 data jones, tom,rt1 box 22,upstate,ny,10000,no phone
  57. 504 data smith, al and sue, 123 elm st.,hometown,nc,27272,(555) 123-4567
  58. 698 data *
  59. 699 rem be sure to run program again    after adding names, then resave.
  60. 700 print"[147]"
  61. 702 print"remember to save the program if you     made any changes to the list."
  62. 705 print" need to save? (y/n)[160][146]";
  63. 706 inputu$
  64. 708 if u$="n"then715
  65. 710 ifu$="y"thenopen15,8,15,"s0:mailing list":close15:save"mailing list",8:goto715
  66. 712 goto700
  67. 715 print:printtab(6)"thanks...all finished!"
  68. 716 end
  69. 1000 data*,*,*,*,*,*,*
  70. 1109 print"[147]hang on a sec..."
  71. 1110 clr  :dim l$(200),f$(200),a$(200),c$(200),s$(200),z$(200),p$(200)
  72. 1140 readl$(nn),f$(nn),a$(nn),c$(nn),s$(nn),z$(nn),p$(nn)
  73. 1142 if l$(nn)="*"then 10
  74. 1150 nn=nn+1
  75. 1155 goto1140
  76. 1159 rem bubble sort
  77. 1160 for i= 0 to nn
  78. 1170 for j =0 to nn
  79. 1175 xn=1
  80. 1180 if  l$(j) <  l$(i) then ln$=  l$(j): l$(j) = l$(i):  l$(i) = ln$
  81. 1190 next j
  82. 1220 next i
  83. 1250 print"[147]"
  84. 1300 for j= nnto 0 step -1
  85. 1301 x=x+1
  86. 1303 if x<>20then1307
  87. 1304 ifx=20thenprint: print"[153] hit space bar ":x=0:print
  88. 1305 geta$:ifa$=""then1305
  89. 1306 print"[147]"
  90. 1307 ifl$(j)="*"thenl$(j)="names in alphabetical order:"
  91. 1310 printl$(j)
  92. 1320 next j
  93. 1330 print:print"[153]"nn"[157] names in directory  "
  94. 1335 print" hit space bar to cont. "
  95. 1340 geta$:ifa$=""then1340
  96. 1350 goto10
  97. 1500 rem print routine
  98. 1505 open4,4
  99. 1510 restore
  100. 1520 readl$,f$,a$,c$,s$,z$,p$
  101. 1522 ifl$="*"then close4:return
  102. 1525 ifl$<>ll$then1520
  103. 1530 ifl$=ll$thenprint#4,f$" "l$
  104. 1533 print#4,a$
  105. 1535 print#4,c$ ", "s$" ";
  106. 1540 print#4,z$
  107. 1545 print#4,p$:print#4:m=1
  108. 1550 ifl$<>"*"then1520
  109. 1555 close4:return
  110.